package cn.edu.sdjzu.xg.service;

import cn.edu.sdjzu.xg.dao.UniversityDao;
import cn.edu.sdjzu.xg.domain.University;
import cn.edu.sdjzu.xg.util.Condition;
import cn.edu.sdjzu.xg.util.Pagination;

import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class UniversityService {
    private static UniversityService universityService = null;
    private static UniversityDao universityDao= UniversityDao.getInstance();
    private UniversityService (){}
    public static UniversityService getInstance(){
        if( universityService==null){
            universityService =new UniversityService();

        }
        return universityService;

    }
    public int add(University university) throws SQLException {
        return UniversityDao.getInstance().add(university);
    }
    public University find(Integer id) throws SQLException{
        return UniversityDao.getInstance().find(id);

    }
    public boolean update(University university)throws SQLException{
        return UniversityDao.getInstance().update(university);

    }
    public boolean delete(Integer id )throws SQLException{
        return UniversityDao.getInstance().delete(id);
    }
    public Collection<University> findAll(Pagination pagination, List<Condition> conditionList)throws SQLException {
        return UniversityDao.getInstance().findAll();
    }

}
